/***************************************************************
 * Name:      AvmUpdateCreatorApp.cpp
 * Purpose:   Code for Application Class
 * Author:    Ke Zhonghua (ke.zhonghua@o-film.com)
 * Created:   2018-07-03
 * Copyright: Ke Zhonghua ()
 * License:
 **************************************************************/

#ifdef WX_PRECOMP
#include "wx_pch.h"
#endif

#ifdef __BORLANDC__
#pragma hdrstop
#endif //__BORLANDC__

#include "AvmUpdateCreatorApp.h"
#include "AvmUpdateCreatorMain.h"

#include <wx/xrc/xmlres.h>

IMPLEMENT_APP(AvmUpdateCreatorApp);

bool AvmUpdateCreatorApp::OnInit()
{
    if(wxApp::OnInit() != true)
    {
        wxMessageBox(_("Platform initialize application  failed!"));
        return false;
    }
    lang = wxLANGUAGE_CHINESE_SIMPLIFIED;
    if(locale.Init(lang, wxLOCALE_DONT_LOAD_DEFAULT))
    {
        wxLocale::AddCatalogLookupPathPrefix("./rc/lang");
    }
    const wxLanguageInfo* pInfo = wxLocale::GetLanguageInfo(lang);
    if (!locale.AddCatalog("avmcreator"))
    {
        wxLogError(_("Couldn't find/load the 'avmcreator' catalog for locale '%s'."),
                   pInfo ? pInfo->GetLocaleName() : _("unknown"));
    }
    locale.AddCatalog("wxstd");

    wxInitAllImageHandlers();
    wxXmlResource::Get()->InitAllHandlers();
    if(!wxXmlResource::Get()->LoadAllFiles(wxT("rc")))
    {
        wxMessageBox(_("Load UI resources failed!"));
        return false;
    }
    AvmUpdateCreatorFrame* frame = new AvmUpdateCreatorFrame(0L, _("AvmUpdateCreator"));

    frame->Show();

    return true;
}

bool AvmUpdateCreatorApp::InitLocale()
{
    return false;
}
